PYSQLITE_VERSION=2.3.3
PYSQLITE_BINARY=pysqlite
PYSQLITE_SOURCE=$(PYSQLITE_BINARY)-$(PYSQLITE_VERSION).tar.gz
PYSQLITE_SITE=http://initd.org/pub/software/pysqlite/releases/2.3/2.3.3/
PYSQLITE_DIR=$(BUILD_DIR)/$(PYSQLITE_BINARY)-$(PYSQLITE_VERSION)
PYSQLITE_SITE_PKG=$(TARGET_DIR)/usr/lib/python2.4/site-packages/pysqlite2

$(DL_DIR)/$(PYSQLITE_SOURCE):
	$(WGET) -P $(DL_DIR) $(PYSQLITE_SITE)/$(PYSQLITE_SOURCE)

$(PYSQLITE_DIR)/.source: $(DL_DIR)/$(PYSQLITE_SOURCE)
	tar -C $(BUILD_DIR) -zxf $(DL_DIR)/$(PYSQLITE_SOURCE)
	toolchain/patch-kernel.sh $(PYSQLITE_DIR) package/pysqlite/ pysqlite\*.patch
	touch $(PYSQLITE_DIR)/.source

$(PYSQLITE_DIR)/.configured: $(PYSQLITE_DIR)/.source
	touch $(PYSQLITE_DIR)/.configured

$(PYSQLITE_BINARY): python sqlite $(PYSQLITE_DIR)/.configured
	mkdir -p $(PYSQLITE_SITE_PKG)
	$(MAKE) -C $(PYSQLITE_DIR) install

$(PYSQLITE_BINARY)-clean:
	$(MAKE) -C $(PYSQLITE_DIR) clean
	rm -rf $(PYSQLITE_SITE_PKG)

$(PYSQLITE_BINARY)-dirclean:
	rm -rf $(PYSQLITE_DIR)

ifeq ($(strip $(BR2_PACKAGE_PYSQLITE)),y)
TARGETS+=$(PYSQLITE_BINARY)
endif
